/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ds.vetxsoft.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author cuero
 */
@Entity
@Table(name = "DESPARASITACIONES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Desparasitacion.findAll", query = "SELECT d FROM Desparasitacion d"),
    @NamedQuery(name = "Desparasitacion.findByCodigo", query = "SELECT d FROM Desparasitacion d WHERE d.codigo = :codigo"),
    @NamedQuery(name = "Desparasitacion.findByDescripcion", query = "SELECT d FROM Desparasitacion d WHERE d.descripcion = :descripcion"),
    @NamedQuery(name = "Desparasitacion.findByCodMascota", query = "SELECT d FROM Desparasitacion d WHERE d.codMascota = :codMascota")})
public class Desparasitacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "CODIGO")
    @GeneratedValue(generator = "codigo", strategy = GenerationType.SEQUENCE)
    private String codigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "COD_MASCOTA")
    private String codMascota;
    @JoinColumn(name = "CODIGO_PDTO", referencedColumnName = "CODIGO")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Producto codigoPdto;
    @JoinColumn(name = "COD_HISTORIA_CLINICA", referencedColumnName = "CODIGO")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private HistoriasClinica codHistoriaClinica;
    @JoinColumn(name = "CED_EMPLEADO", referencedColumnName = "CEDULA")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Empleado cedEmpleado;

    public Desparasitacion() {
    }

    public Desparasitacion(String codigo) {
        this.codigo = codigo;
    }

    public Desparasitacion(String codigo, String descripcion, String codMascota) {
        this.codigo = codigo;
        this.descripcion = descripcion;
        this.codMascota = codMascota;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getCodMascota() {
        return codMascota;
    }

    public void setCodMascota(String codMascota) {
        this.codMascota = codMascota;
    }

    public Producto getCodigoPdto() {
        return codigoPdto;
    }

    public void setCodigoPdto(Producto codigoPdto) {
        this.codigoPdto = codigoPdto;
    }

    public HistoriasClinica getCodHistoriaClinica() {
        return codHistoriaClinica;
    }

    public void setCodHistoriaClinica(HistoriasClinica codHistoriaClinica) {
        this.codHistoriaClinica = codHistoriaClinica;
    }

    public Empleado getCedEmpleado() {
        return cedEmpleado;
    }

    public void setCedEmpleado(Empleado cedEmpleado) {
        this.cedEmpleado = cedEmpleado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Desparasitacion)) {
            return false;
        }
        Desparasitacion other = (Desparasitacion) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.ds.vetxsoft.entity.Desparasitacion[ codigo=" + codigo + " ]";
    }
    
}
